import 'package:clean_app/asset/color.dart';
import 'package:clean_app/asset/textstyle.dart';
import 'package:clean_app/pages/collect_tab/all_tabs.dart';
import 'package:clean_app/provider/login_provider.dart';
import 'package:flutter/material.dart';

class CollectTab extends StatefulWidget {
  const CollectTab({super.key});

  @override
  State<CollectTab> createState() => _CollectTabState();
}

class _CollectTabState extends State<CollectTab> {
  @override
  Widget build(BuildContext context) {
    if (!isLogined(context)) {
      return Scaffold(
        appBar: AppBar(
          toolbarHeight: 0,
          backgroundColor: os_white,
          surfaceTintColor: os_white,
        ),
        backgroundColor: os_white,
        body: ListView(children: [
          Container(
            padding: EdgeInsets.only(left: 20, right: 20),
            child: Column(
              children: [
                Container(height: 200),
                Icon(
                  Icons.person,
                  size: 50,
                  color: os_color,
                ),
                Container(height: 15),
                Text(
                  "请先登录",
                  style: TextStyle(
                    fontSize: 22,
                    fontWeight: FontWeight.bold,
                  ),
                ),
                Container(height: 10),
                Text(
                  "登录后方可进行数据采集",
                  style: TextStyle(fontSize: 16),
                ),
                Container(height: 60),
                ElevatedButton(
                  style: ButtonStyle(
                    elevation: WidgetStatePropertyAll(0),
                    backgroundColor: WidgetStatePropertyAll(os_color_opa),
                    foregroundColor: WidgetStatePropertyAll(os_color),
                    padding: WidgetStatePropertyAll(
                      EdgeInsets.symmetric(vertical: 15, horizontal: 40),
                    ),
                  ),
                  onPressed: () {
                    Navigator.of(context).pushNamed("/login_with_pwd");
                  },
                  child: Text(
                    "前往登录",
                    style: XSTextStyle(
                      context: context,
                      fontSize: 16,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                )
              ],
            ),
          )
        ]),
      );
    }
    return AllTabs();
  }
}
